#include "widget.h"
#include "ui_widget.h"
#include <QString>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    connect(ui->pushButton,&QPushButton::clicked,this, &Widget::func);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::func()
{
    if(ui->pushButton->text() == QString("hello world"))
        ui->pushButton->setText("hello qt");
    else
        ui->pushButton->setText("hello world");
}

